package com.hhxy.utils.response;

/**
 * @author ghp
 * @date 2023/3/21
 * @title HTTP请求封装类
 * @description 用于封装状态码和响应给前台的提示信息
 */
public enum AppHttpCodeEnum {

    /**
     * 成功
     */
    SUCCESS(200, "成功"),
    SUCCESS_INSERT(201, "新增成功"),
    SUCCESS_DELETE(202, "删除成功"),
    SUCCESS_UPDATE(203, "修改成功"),
    SUCCESS_SELECT(204, "查找成功"),

    /**
     * 客户端出错
     */
    CLIENT_ERROR(300, "客户端错误"),
    CLIENT_PASSWORD_ERROR(301, "密码输入有误"),
    CLIENT_ACCOUNT_ERROR(302, "该账号不存在"),
    CLIENT_ACCOUNT_PASSWORD_ERROR(303, "账号或密码错误"),
    CLIENT_UNLOGIN_ERROR(304, "用户未登录"),
    CLIENT_TOKEN_ERROR(305, "token超时或非法"),
    CLIENT_COMMENT_ERROR(306, "评论不能为空"),
    CLIENT_USER_ERROR(307, "用户输入不合法"),
    CLIENT_IMG_ERROR(308, "不支持该图片格式"),
    CLIENT_EMAIL_ERROR(309, "该邮箱已被注册"),
    CLIENT_USERNAME_ERROR(310, "该账号已存在"),
    CLIENT_TAG_ERROR(311, "该标签下存在文章，不能删除"),
    CLIENT_MENU_ERROR(312, "该菜单下存在子菜单，不能删除"),
    CLIENT_USERDELETE_ERROR(313, "不能删除当前你正在使用的用户"),
    CLIENT_CATEGORY_ERROR(314, "该分类下有文章，不能直接删除保护"),

    /**
     * 系统出错
     */
    SYSTEM_ERROR(400, "系统执行出错"),
    SYSTEM_TIME_ERROR(401, "系统执行超时"),
    SYSTEM_UNPOWER_ERROR(402, "权限不足"),
    SYSTEM_AUTHENTICATION_ERROR(403, "权限认证失败"),

    /**
     * 第三方服务出错
     */
    SERVICE_ERROR(500, "网络出现了问题"),
    SERVICE_INSERT_ERROR(501, "新增失败"),
    SERVICE_DELETE_ERROR(502, "删除失败"),
    SERVICE_UPDATE_ERROR(503, "修改失败"),
    SERVICE_SELECT_ERROR(504, "查询失败"),
    SERVICE_REDIS_ERROR(505, "redis中的key已失效");

    /**
     * 状态码
     */
    Integer code;

    /**
     * 错误信息
     */
    String msg;

    AppHttpCodeEnum(Integer code, String Message) {
        this.code = code;
        this.msg = Message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
